<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
	<%@  taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<!DOCTYPE html>
<html lang="en">
<%@ include file="common/head.jsp"%>

<body class="fix-header fix-sidebar">

	<!-- Preloader - style you can find in spinners.css -->
	<div class="preloader">
		<svg class="circular" viewBox="25 25 50 50">
				<circle class="path" cx="50" cy="50" r="20" fill="none"
				stroke-width="2" stroke-miterlimit="10" /> </svg>
	</div>
	<!-- Main wrapper  -->
	<div id="main-wrapper">
		<!-- header header  -->
		<%@ include file="common/header.jsp"%>
		<!-- End header header -->
		<!-- Left Sidebar  -->
		<%@ include file="common/nav.jsp"%>
		<!-- End Left Sidebar  -->
		<!-- Page wrapper  -->
		<div class="page-wrapper">
			<!-- 锐高软件 -->
			 <%@ include file="../common/ruigao.jsp" %>
			<!--
                    	作者：offline
                    	时间：2018-03-26
                    	描述：查看信息
                    -->
			<div class="container-fluid">
				<!-- Start Page Content -->
				<div class="row justify-content-center">
					<div class="col-12">
						<div class="card">
							<div class="card-body">
								<div class="card-content">
									<!-- Left sidebar -->
									<div class="inbox-leftbar">
										<a class="btn btn-danger btn-block waves-effect waves-light"
											href="${pageContext.request.contextPath}/message_add.jsp"> <font style="vertical-align: inherit;">
												<font style="vertical-align: inherit;">发起通知</font>
										</font>
										</a>

									</div>

								</div>
								<!-- End Left sidebar -->

								<div class="inbox-rightbar">

									<div role="toolbar" class="">
										<div class="btn-group">
											<button class="btn btn-light waves-effect" type="button">
												<i class="mdi mdi-archive font-18 vertical-middle"></i>
											</button>
											<button class="btn btn-light waves-effect" type="button">
												<i class="mdi mdi-alert-octagon font-18 vertical-middle"></i>
											</button>
											<button class="btn btn-light waves-effect" type="button">
												<i class="mdi mdi-delete-variant font-18 vertical-middle"></i>
											</button>
										</div>

										<div class="btn-group show">
											<button aria-expanded="false" data-toggle="dropdown"
												class="btn btn-light dropdown-toggle waves-effect"
												type="button">
												<font style="vertical-align: inherit;"><font
													style="vertical-align: inherit;"> 更多 </font></font><span
													class="caret m-l-5"></span>
											</button>
											<div class="dropdown-menu">
														<%@ include file="../listall/companyall.jsp"%>
	                                         <c:forEach var="sels" items="${selectcompany}">
												<a href="messageserviceselect?companyids=${sels.companyId}" class="dropdown-item">  ${sels.companyName}</a>
									       </c:forEach>
											</div>
										</div>
									</div>
								</div>
								<div class="">
									<div class="mt-4">
										<table class="table">
										
											<thead>
												<tr>
													<th><font style="vertical-align: inherit;"> <font
															style="vertical-align: inherit;">通知类型</font>
													</font></th>
													<th><font style="vertical-align: inherit;"> <font
															style="vertical-align: inherit;">通知标题</font>
													</font></th>
													<th><font style="vertical-align: inherit;"> <font
															style="vertical-align: inherit;">通知时间</font>
													</font></th>
													<th><font style="vertical-align: inherit;"> <font
															style="vertical-align: inherit;">操作</font>
													</font></th>
												</tr>
											</thead>
										
													  <c:forEach items="${pageInfo.getPageList()}" var="message">
											<tbody>
												<tr>
													
												
											
													<td><font style="vertical-align: inherit;"> <font
															style="vertical-align: inherit;">${message.messageTypes }</font>
													</font></td>
													<td><font style="vertical-align: inherit;"> <font
															style="vertical-align: inherit;">${message.messageTitle }</font>
													</font></td>
													<td><font style="vertical-align: inherit;"> <font
															style="vertical-align: inherit;">${message.messageTimes }</font>
													</font></td>
													<td>
	                                          
														<button type="button"
															class="btn btn-success btn-sm btn-rounded m-b-2 m-l-5">
															<a href="${pageContext.request.contextPath}/messageservice?rid=${message.messageId}&opt=selectuser" style="color: white;">查看</a>
																<input type="hidden" name="rid" id="rid" value="${message.messageId}">
														</button>
														<button type="button"
															class="btn btn-sm btn-rounded m-b-2 dels" style="background: #d01d13d6;">
															<a href="javascript:;"  style="color: white;">删除</a>
																<input type="hidden" name="del" id="del" value="${message.messageId}">
														</button>
													</td>
												</tr>
											</tbody>
											  </c:forEach>
										</table>
									</div>
									<!-- panel body -->
									<!-- panel -->
									<!--上一页--下一页-->
										<!-- panel body -->

									<!-- panel -->

									<!--
                                                 	作者：offline
                                                 	时间：2018-04-08
                                                 	描述：上一页下一页
                                                 -->
                                    <div class="table-responsive m-t-40">
										<div id="example23_wrapper" class="dataTables_wrapper">
											<div class="dataTables_paginate paging_simple_numbers"
												id="example23_paginate">
											    <a href="messageserviceselect?PageNo=1&companyids=${OaCompanyId}" class="paginate_button"
													aria-controls="example23" data-dt-idx="7" tabindex="0"
													id="example23"> <font style="vertical-align: inherit;"> 
														<font style="vertical-align: inherit;"></font>首页
												</font>
												</a>
											    
											    <c:if test="${pageInfo.getHasPrevPage() }">
															<a  href="messageserviceselect?pageNo=${pageInfo.getPrevPage() }&companyids=${OaCompanyId}" class="paginate_button previous disabled"
													aria-controls="example23" data-dt-idx="0" tabindex="0"
													id="example23_previous"><font
													style="vertical-align: inherit;"><font
														style="vertical-align: inherit;">上一页</font></font>
												</a>
												</c:if>
												<span>
												
												 <c:forEach items="${pageInfo.groupPage}" var="pageI">
													<a href="messageserviceselect?PageNo=${pageI}&companyids=${OaCompanyId}"
													class="paginate_button" aria-controls="example23"
													data-dt-idx="7" tabindex="0" id="example23"> <font
													style="vertical-align: inherit;"> <font
														style="vertical-align: inherit;">${pageI }</font></font>
												   </a>
												</c:forEach>
												</span>
														
												<c:if test="${pageInfo.getHasNextPage()}">
									            	<a 	href="messageserviceselect?pageNo=${pageInfo.getNextPage() }&companyids=${OaCompanyId}"
													class="paginate_button next" aria-controls="example23"
													data-dt-idx="7" tabindex="0" id="example23_next"><font
													style="vertical-align: inherit;"><font
														style="vertical-align: inherit;">下一页</font></font></a>
													</c:if>
													
													<a href="messageserviceselect?PageNo=${pageInfo.getTotalPage()}&companyids=${OaCompanyId}"
													class="paginate_button" aria-controls="example23"
													data-dt-idx="7" tabindex="0" id="example23"> <font
													style="vertical-align: inherit;"> <font
														style="vertical-align: inherit;"></font>末页
												</font>
												</a>
											</div>
										</div>
									</div>                   
								</div>

								<div class="clearfix"></div>

							</div>
						</div>
					</div>
				</div>
			</div>
		</div>
	</div>
	<!-- End Container fluid  -->
	<!-- footer -->
	<%@ include file="common/footer.jsp"%>
	<!-- End footer -->
	<!-- End Page wrapper  -->
	<%@ include file="common/js.jsp"%>

<script type="text/javascript">
$(function() {
	//判断当前登录的员工的权限
	var competence = ${competence};
	if(competence!=3){
		$(".show").html("");
	}
	//点击删除
	$(".dels").click(function() {
     var dels=$(this).find("#del").val();
		swal({
			title :"您确定要删除该通知吗？",
			animation : "slide-from-top",
			showCancelButton : true,
			closeOnConfirm : false,
			cancelButtonText : "取消",
			confirmButtonText : "确定"
			},
			function(inputValue) {
				if(inputValue === false) return false;
					$.ajax({
						url :"messageservice",
						type : "GET",
						data:{"del":dels,"opt":"del"},
						datatype : "JSON",
						success : function(data) {
						if (data) {
							swal({
								title : "删除成功,<span style='color:red'>已删除</span>该通知",
								html : true,
								type : "success",
								showCancelButton : false,
								showConfirmButton : true,
								confirmButtonText : "确定",
							},function(){
								location.reload();
							});
						}else{
							
						}
					},
					error : function(data) {
						swal({
							title : '删除失败！',
							type : 'error',
							confirmButtonText : '确定',
							closeOnConfirm : false
						});
					}
				});
			}
		);
	});
});


</script>
</body>

</html>